<text><span class="style6">ask It!</span><span class="style4">What it is:</span><span class="style2"> This stack is a tool for graying out painting in HyperCard. This would be used, for example, to simulate a disabled button in HyperCard.</span><span class="style4">How it works:</span><span class="style2"> Simply place/create the art you want masked onto the card paint layer and then click "Mask It!". The cursor will turn to a cross and you will then define the rectangle to be masked. The image will then be masked. Use the "Make a Copy of:" popup to select what will be placed into the clipboard after the masking operation is complete.</span><span class="style4">What else:</span><span class="style2"> If you need more room then you can resize the card window by clicking on the grow box button at the bottom right-hand corner of the window.</span></text>
</content>
<content>
<layer>background</layer>
<id>12</id>
<text>Nothing</text>
</content>
<name></name>
<script>on doMask preWarmif preWarm is true then exit doMaskset cursor to watchlock screen-- do check for card layer artworkchoose select tooldoMenu "Select"get the toolchoose browse toolif it is not "Lasso Tool" thenanswer "There is no artwork on the card layer." -- ∆exit doMaskelse unlock screen-- setting cursor and getting the rectput "Select the rect to be masked by click-dragging a rectangle."put Ants() into theRectput theRect into bg fld "Last Rect"set cursor to watchlock screenput item 1 of theRect into theLeftput item 2 of theRect into theTopput item 3 of theRect into theRightput item 4 of theRect into theBottom-- putting a copy of the graphics rect into the clipboardput bg fld "Copy What" into copyWhatif copyWhat is "Original Art" thenchoose select tooldrag from (item 1 to 2 of theRect) to (item 3 to 4 of theRect)doMenu "Copy Picture"end if-- setting up the masking environmentchoose brush toolput the brush into SvBrushput the pattern into SvPatternset the brush to 28set the pattern to 1-- when then vert coordinate is even & the horiz coordinate is odd the pixel is black-- when then vert coordinate is odd & the horiz coordinate is even the pixel is whiteput even(theLeft) into theLeftEvenrepeat with vertCd=theTop to theBottomset cursor to busyput theLeft into horizCdput even(vertCd) into vertEvenif (vertEven and theLeftEven) or (not vertEven and not theLeftEven) then add 1 to horizCdrepeat until horizCd>theRightif thePixel(horizCd, vertCd) is "black" then click at horizCd,vertCdadd 2 to horizCdend repeatunlock screenlock screenend repeat-- getting rid of the opaque white spacechoose select tooldrag from (item 1 to 2 of theRect) to (item 3 to 4 of theRect) with optionKeyif copyWhat is "Masked Art" thenchoose select tooldrag from (item 1 to 2 of theRect) to (item 3 to 4 of theRect)doMenu "Copy Picture"end if-- resetting the propertiesset the brush to SvBrushset the pattern to SvPatternchoose browse toolput "Masking complete."beepend doMaskfunction odd theNumreturn (theNum/2) ≠ trunc(theNum/2)end oddfunction even theNumreturn (theNum/2) = trunc(theNum/2)end even-- if I go to a XCMD, use patBic for the transfer mode.--------------------------------------****** SPLIT BAR HORIZONTAL ****--------------------------------------global theMode:I,pixThick:I, minY:I,maxY:I,lastY:I,startX:I,endX:Ifunction splitBarH minHeight, maxHeight, cursorV, leftX, rightX, thePenMode,thickness,penPatternput cursorV+0 into lastYput minHeight+0 into minYput maxHeight+0 into maxYput leftX+0 into startXput rightX+0 into endXput 0+0 into theModeif thePenMode is empty then put 0+0 into thePenModeadd thePenMode to theModeput 0+0 into pixThickif thickness is empty then put 1+0 into thicknessadd thickness div 1 to pixThickif penPattern is empty then put "gray" into penPattern----------------------------------- first set the correct patternif penPattern = "Black" thenpenPat blackend ifif penPattern = "gray" thenpenPat grayend ifif penPattern = "ltgray" thenpenPat ltgrayend ifif penPattern = "dkgray" thenpenPat dkgrayend ifif penPattern = "white" thenpenPat whiteend if-----penMode theModepenSize 1,pixThick----------------------------------- draw the initial line the user sees.moveTo startX,lastYlineTo endX,lastYput 0+0 into y -- intiliaze this to 0if pixThick > 2 then put pixThick div 2 into locAdjuster------------------------------------------------------repeat-- use toolbox call which gets "the mouseLoc".-- The "mouseVH" container is a 32 bit longInteger which contains the horizontal-- coordinate in the "LoWord" and the vertical coordinate in the "HiWord".GetMouse mouseVHsubtract y from yadd HiWord(mouseVH) - locAdjuster to y --click offset-- clip "the mouseLoc" to the upper and lower limits.if y < minY thensubtract y from yadd minY to yend ifif y > maxY thensubtract y from yadd maxY to yend if-- If the new position is different than the last one, then draw a new line,-- otherwise, don't do anything thereby avoiding a flickering of the line-- as it would be erased and redrawn at the same position constantly.if y <> lastY then-- "Erase" the previous line by drawing it again, with our two statements.lineTo startX,lastY-- put the new mouseH into lastYsubtract lastY from lastYadd y to lastY-- "Draw" the new line with our two statements.moveTo startX,lastYlineTo endX,lastYend if -- we drew a new line.-- Use the "Button()" toolbox call to see if the mouse button is up. If it is,-- exit the repeat loop, otherwise get "the mouseLoc" for the next repeat.if not button() then exit repeatend repeat---------------------------------- Done. Erase the current line by drawing it again.lineTo startX,lastY----------------------------------- Finally, return the new Y, which could be the same as before or differentreturn lastYend splitBarH-- Note that the penState should be fetched and save before invoking this eternal and restored afterwords. Since this is not implemented this XFCN is incomplete</script>